package org.jeecg.modules.energymonitor.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.aspect.annotation.AutoLog;
import org.jeecg.common.system.base.controller.JeecgController;
import org.jeecg.modules.earlywarning.rules.entity.EwRules;
import org.jeecg.modules.earlywarning.rules.service.IEwRulesService;
import org.jeecg.modules.energymonitor.vo.EnergyMoniterVo;
import org.jeecg.modules.equipment.gasmeter.service.IDmGasmeterService;
import org.jeecg.modules.equipment.steammeter.service.IDmSteammeterService;
import org.jeecg.modules.equipment.watermeter.service.IDmWatermeterService;
import org.jeecg.modules.equipment.watthourmeter.service.IDmWatthourmeterService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * @Description: 能源监测
 * @Author: 贾送兵
 * @Date:   2021-11-30
 * @Version: V1.0
 */
@Api(tags="能源检测")
@RestController
@RequestMapping("/enerymonitor")
@Slf4j
public class EneryMonitorController extends JeecgController<EwRules, IEwRulesService> {
	 @Autowired
	 private IEwRulesService ewRulesService;
	 @Autowired
	 private IDmGasmeterService dmGasmeterService;//燃气表管理
	 @Autowired
	 private IDmWatthourmeterService dmWatthourmeterService;//电表管理啊

	 @Autowired
	 private IDmWatermeterService dmWatermeterService;//水表管理

	 @Autowired
	 private IDmSteammeterService dmSteammeterService;//蒸汽表管理



	@AutoLog(value = "监测统计数据")
	@ApiOperation(value="监测统计数据", notes="监测统计数据")

	@ApiImplicitParams(value = {
			@ApiImplicitParam(name = "id",value = "主键",dataType = "String",required = false),
			@ApiImplicitParam(name = "type",value = "能源类型标识，燃气输入RQ，蒸汽输入ZQ，水输入S，电输入DB",dataType = "String",required = false)
	})
	@GetMapping(value = "/queryeEnergymonitor")
	public Result<?> queryeBycode(HttpServletRequest req, @RequestParam(name="id") String id,@RequestParam(name="type") String type) {

		EnergyMoniterVo vo = new EnergyMoniterVo();
		if(StringUtils.isNotEmpty(type)){
			if(type.equals("RQ")){
				vo.setGrandTotal(5990);
				vo.setLastMonth(66);
				vo.setThisMonth(44);
				vo.setYesterdayNum(77);
			}else if(type.equals("ZQ")){
				vo.setGrandTotal(6990);
				vo.setLastMonth(33);
				vo.setThisMonth(34);
				vo.setYesterdayNum(544);
			}else if(type.equals("S")){
				vo.setGrandTotal(7990);
				vo.setLastMonth(75);
				vo.setThisMonth(353);
				vo.setYesterdayNum(22);
			}else if(type.equals("DB")){
				vo.setGrandTotal(8990);
				vo.setLastMonth(644);
				vo.setThisMonth(33);
				vo.setYesterdayNum(445);
			}
		}

		return Result.OK(vo);
	}

}
